<template>
    <view>
        <view class="home_menu_content home_menu">
            <view class="home_menu_item" v-for="(item, index) in list" :key="index" @click="tablist(item.url, index)">
                <image style="width: 120rpx; height: 70rpx" :src="item.img"></image>
                <label style="color: #333333; font-size: 24rpx; font-weight: 500">{{ item.title }}</label>
            </view>
        </view>
    </view>
</template>

<script>
export default {
    name: "home-menu",
    data() {
        return {
            list: [
                {
                    title: "知识文章",
                    img: "https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/homemenu/zswz.png",
                    url: "/packageHome/pages/article/article",
                },
                {
                    title: "推荐食谱",
                    img: "https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/homemenu/tjsp.png",
                    url: "/packageHome/pages/cookbook/cookbook",
                },
                {
                    title: "健康指南",
                    img: "https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/homemenu/hhb.png",
                    url: "/packageHome/pages/redblack/redblack",
                },
                {
                    title: "用户故事",
                    img: "https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/homemenu/yhgs.png",
                    url: "/packageHome/pages/story/story",
                },
                {
                    title: "领券中心",
                    img: "https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/showNum1.png",
                    url: "/packageStaff/pages/collectionCenter/index",
                },
                {
                    title: "减重案例",
                    img: "https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/showNum2.png",
                    url: "/packageHome/pages/loseWeightContrast/index",
                },
                {
                    title: "测量记录",
                    img: "https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/showNum3.png",
                    url: "/packageMine/pages/measureRecords/measureRecords",
                },
                {
                    title: "检测报告",
                    img: "https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/inspection-report.png",
                    url: "/packageHome/pages/inspectionReport/index",
                },
            ],
        };
    },
    methods: {
        tablist(url, index) {
            if (index == 1) {
                this.$emit("goToCookbook");
            } else {
                uni.navigateTo({
                    url: url,
                });
            }
        },
    },
};
</script>
